<!--
 * @Author: ૮₍ ˙О˙₎ა
 * @Date: 2023-08-05 09:28:52
-->
<template>
  <div class="search">
    <h2>网易严选</h2>
    <van-search @focus="toSearch" placeholder="请输入搜索关键词" />
    <van-button v-if="!token" class="van-button" plain type="danger" size="mini" to="/my"
      >登录</van-button
    >
  </div>
</template>

<script lang="ts" setup>
import router from '@/router'
import { onMounted, ref } from 'vue'

const toSearch = () => {
  router.push('/search')
}

const token = ref()
onMounted(() => {
  token.value = localStorage.getItem('token')
  console.log(token.value)
})
</script>

<script lang="ts">
export default {
  name: 'SearchView'
}
</script>

<style lang="less" scoped>
.search {
  display: flex;
  h2 {
    margin: 15px;
  }
  .van-button {
    margin-top: 15px;
  }
}
</style>
